import cv2

# 读取图像
img = cv2.imread("./img/logo.png")
print(img.shape)  # (447, 384, 3)
# 三通道：blue green red 三个颜色的通道
blue_channel = img[:, :, 0]
green_channel = img[:, :, 1]
red_channel = img[:, :, 2]
print(blue_channel.shape)  # (447, 384)
# 通常cv2.imshow 不仅可以显示3通道的彩色图，也可以显示1通道的黑白图
cv2.imshow("blue", blue_channel)
cv2.imshow("green", green_channel)
cv2.imshow("red", red_channel)
cv2.waitKey(0)
